#include <iostream>
#include <map>
using namespace std;

int main(){
	freopen("in.txt","r",stdin);
	char s[1005];
	cin.getline(s,1005,'\n');
	map<char,int> mp;
	for(int i=0; s[i]!='\0'; i++){
		if(s[i]>='A' && s[i]<='Z') mp[s[i]+('a'-'A')]++;
		else if( s[i]>='a' && s[i]<='z')mp[s[i]]++;
		cout << s[i];
	}
	cout << endl;
	char alp = '\0';
	int count = 0; 
	for(auto it=mp.begin(); it!=mp.end(); it++){
		if((*it).second>count) {
			count = (*it).second;
			alp = (*it).first;
		}else if( (*it).second==count&& (*it).first<alp) alp = (*it).first;
	}
	cout << alp << " " << count << endl;
	return 0;
}
